<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>5.ES6_this</title>
</head>
<body>
<script>
  function  foo1(){
    console.log(this);
    let foo2 =()=>{
      console.log(this);
    }
    foo2();
  }

  foo1();//window


  /*
  在class中定义的函数不存在直接调用 只能通过对象.方法名()的方式进行调用
  所以方法的this始终都是类对象
  * */
  class School{
    getThis(){
      console.log(this);
      let foo3 =()=>{
        console.log(this);
      }
      foo3();
    }
  }

  let school = new  School();
  school.getThis();
</script>
</body>
</html>